package com.zimin.cloud.system.controller.api;


import com.zimin.authorize.annotation.Authorize;
import com.zimin.cloud.mine.pojo.system.business.PageConfigBO;
import com.zimin.shared.annotation.OpLog;
import com.zimin.shared.enums.ModuleEnum;
import com.zimin.shared.pojo.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 页面配置信息 前端控制器 接口
 * </p>
 *
 * @author zimin
 * @since 2022-05-15 18:14
 */
@RequestMapping("/sys/page/config")
public interface IPageConfigController {

    /**
     * <p>根据页面类型获取页面配置</p>
     *
     * @param pageType 页面类型
     * @return com.zimin.shared.pojo.Result
     * @since 2022-05-15 18:21:47
     */
    @GetMapping("/{pageType}/{status}")
    @Authorize(hasPerMi = "system:page:config:findPage")
    @OpLog(module = ModuleEnum.SYSTEM, action = "根据页面类型获取页面配置")
    @ApiOperation(value = "根据页面类型获取页面配置", notes = "根据页面类型获取页面配置", httpMethod = "GET")
    Result findPageConfigByType (@PathVariable(name = "pageType") String pageType);

    /**
     * <p>保存页面配置</p>
     *
     * @param pageConfigBO 页面配置
     * @return com.zimin.shared.pojo.Result
     * @since 2022-05-15 18:25:29
     */
    @PostMapping
    @Authorize(hasPerMi = "system:page:config:save")
    @OpLog(module = ModuleEnum.SYSTEM, action = "保存页面配置")
    @ApiOperation(value = "保存页面配置", notes = "保存页面配置", httpMethod = "POST")
    Result savePageConfig(@RequestBody PageConfigBO pageConfigBO);

    /**
     * <p>更新页面配置</p>
     *
     * @param pageConfigBO 页面配置参数
     * @return com.zimin.shared.pojo.Result
     * @since 2022-05-15 18:29:46
     */
    @PutMapping
    @Authorize(hasPerMi = "system:page:config:update")
    @OpLog(module = ModuleEnum.SYSTEM, action = "更新页面配置")
    @ApiOperation(value = "更新页面配置", notes = "更新页面配置", httpMethod = "PUT")
    Result updatePageConfig(@RequestBody PageConfigBO pageConfigBO);

    /**
     * <p>设置页面状态</p>
     *
     * @param pageConfigBO 更新页面
     * @return com.zimin.shared.pojo.Result
     * @since 2022-05-24 10:04:45
     */
    @PutMapping("/status")
    @Authorize(hasPerMi = "system:page:config:status")
    @OpLog(module = ModuleEnum.SYSTEM, action = "更新页面状态")
    @ApiOperation(value = "更新页面状态", notes = "更新页面状态", httpMethod = "PUT")
    Result setPageConfigStatus(@RequestBody PageConfigBO pageConfigBO);

    /**
     * <p>根据ID删除页面信息</p>
     *
     * @param id 页面配置ID
     * @return com.zimin.shared.pojo.Result
     * @since 2022-05-15 18:30:33
     */
    @DeleteMapping("/{id}")
    @Authorize(hasPerMi = "system:page:config:delete")
    @OpLog(module = ModuleEnum.SYSTEM, action = "根据ID删除")
    @ApiOperation(value = "根据ID删除", notes = "根据ID删除", httpMethod = "DELETE")
    Result removePageById(@PathVariable(name = "id") String id);
}
